<template>
  <div class="app">
    <!-- 导航栏 (保持不变) -->
    <header>
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <meta name="description" content="安心陪诊服务平台提供全国各大医院全天、半天、诊前约号、预约挂号等陪诊服务">
      <div class="container">
        <nav>
          <div class="logo">
            <a href="/">安心<span>陪诊</span></a>
          </div>
          <ul class="nav-links">
            <li><a href="/">首页</a></li>
            <li><a href="#" @click.prevent="goToServiceType">服务项目</a></li>
            <li><a href="#" @click.prevent="goToServiceProcess">服务流程</a></li>
            <li><a href="#" @click.prevent="goToNotice">公告中心</a></li>
            <li
                @mouseenter="showDropdown('about')"
                @mouseleave="hideDropdown()"
                @click.stop="toggleDropdown('about')"
            >
              <a href="#" @click.prevent class="active">
                关于我们
                <el-icon><ArrowDown /></el-icon>
              </a>
              <ul
                  class="dropdown-menu"
                  v-if="activeDropdown === 'about'"
                  @mouseenter="cancelHide()"
                  @mouseleave="hideDropdown()"
              >
                <li><a href="#" @click="router.push('/about')">项目简介</a></li>
                <li><a href="#" @click="router.push('/contact')">联系我们</a></li>
              </ul>
            </li>
          </ul>
          <div class="nav-buttons">
            <button @click="goToLogin" class="btn">登录</button>
            <button @click="goToRegister" class="btn">注册</button>
          </div>
        </nav>
      </div>
    </header>

    <!-- 联系我们的内容区域 -->
    <main class="contact-container">
      <div class="container">
        <div class="section-title">
          <h2>联系我们</h2>
          <p>有任何问题或建议，欢迎随时联系我们</p>
        </div>

        <div class="contact-content">
          <!-- 联系方式 -->
          <section class="contact-section">
            <h3>联系方式</h3>
            <div class="section-content">
              <div class="contact-methods">
                <div class="contact-method">
                  <div class="method-icon">📞</div>
                  <div class="method-text">
                    <h4>客服电话</h4>
                    <p>400-123-4567</p>
                    <p class="time">服务时间：8:00-22:00（全年无休）</p>
                  </div>
                </div>
                <div class="contact-method">
                  <div class="method-icon">✉️</div>
                  <div class="method-text">
                    <h4>电子邮箱</h4>
                    <p>service@anxinpeizhen.com</p>
                    <p class="time">我们会在24小时内回复您的邮件</p>
                  </div>
                </div>
                <div class="contact-method">
                  <div class="method-icon">🏢</div>
                  <div class="method-text">
                    <h4>公司地址</h4>
                    <p>云南省昆明市呈贡区昆明理工大学</p>
                    <p class="time">工作时间：周一至周五 9:00-18:00</p>
                  </div>
                </div>
              </div>
            </div>
          </section>

          <!-- 在线留言 -->
          <section class="contact-section">
            <h3>在线留言</h3>
            <div class="section-content">
              <form class="contact-form">
                <div class="form-group">
                  <label for="phone">联系电话</label>
                  <input type="tel" id="phone" placeholder="请输入您的联系电话">
                </div>
                <div class="form-group">
                  <label for="email">电子邮箱</label>
                  <input type="email" id="email" placeholder="请输入您的电子邮箱">
                </div>
                <div class="form-group">
                  <label for="message">留言内容</label>
                  <textarea id="message" rows="5" placeholder="请输入您的留言内容，我们会尽快回复您"></textarea>
                </div>
                <button type="submit" class="btn">提交留言</button>
              </form>
            </div>
          </section>

          <!-- 常见问题 -->
          <section class="contact-section">
            <h3>常见问题</h3>
            <div class="section-content">
              <div class="faq-list">
                <div class="faq-item">
                  <h4>Q: 如何预约陪诊服务？</h4>
                  <p>A: 您可以通过网站在线预约，或拨打客服电话400-123-4567进行人工预约。</p>
                </div>
                <div class="faq-item">
                  <h4>Q: 陪诊服务的收费标准是什么？</h4>
                  <p>A: 我们提供多种服务套餐，价格根据服务时长和内容有所不同，具体请咨询客服。</p>
                </div>
                <div class="faq-item">
                  <h4>Q: 可以临时取消预约吗？</h4>
                  <p>A: 可以，请在服务开始前至少2小时通知我们，以免产生取消费用。</p>
                </div>
              </div>
            </div>
          </section>
        </div>
      </div>
    </main>

    <!-- 页脚 (保持不变) -->
    <footer>
      <div class="container">
        <div class="footer-content">
          <div class="footer-section">
            <h3>关于我们</h3>
            <p>安心陪诊致力于为需要就医陪伴的用户提供专业、贴心的陪诊服务。</p>
          </div>
          <div class="footer-section">
            <h3>快速链接</h3>
            <ul>
              <li><a href="/">首页</a></li>
              <li><a href="/about">关于我们</a></li>
              <li><a href="/contact">联系我们</a></li>
              <li><a href="#" @click.prevent="goToUserAgreement">用户协议</a></li>
              <li><a href="#" @click.prevent="goToPrivacyPolicy">隐私政策</a></li>
            </ul>
          </div>
          <div class="footer-section">
            <h3>联系我们</h3>
            <p>电话：400-123-4567</p>
            <p>邮箱：service@anxinpeizhen.com</p>
          </div>
        </div>
        <div class="copyright">
          <p>&copy; 2025 安心陪诊平台 版权所有</p>
        </div>
      </div>
    </footer>
  </div>
</template>

<script setup>
import { useRouter } from "vue-router"
import { ArrowDown } from '@element-plus/icons-vue'
import {ref} from "vue";

const router = useRouter()

// 下拉菜单相关逻辑
const activeDropdown = ref(null)
const hoverTimeout = ref(null)

const dropdownOptions = {
  'escort': [
    { name: '陪诊师列表', path: '/escort/list' },
    { name: '陪诊师认证', path: '/escort/certification' }
  ],
  'about': [
    { name: '项目简介', path: '/about' },
    { name: '联系我们', path: '/contact' }
  ]
}

// 导航相关方法
const showDropdown = (menu) => {
  clearTimeout(hoverTimeout.value)
  activeDropdown.value = menu
}

const hideDropdown = () => {
  hoverTimeout.value = setTimeout(() => {
    activeDropdown.value = null
  }, 200)
}

const cancelHide = () => {
  clearTimeout(hoverTimeout.value)
}

const toggleDropdown = (menu) => {
  activeDropdown.value = activeDropdown.value === menu ? null : menu
}

const goToRegister = () => {
  router.push('/register')
}

const goToLogin = () => {
  router.push('/login')
}

const goToNotice = () => {
  router.push('/notice')
}

const goToUserAgreement = () => {
  router.push('/userAgreement')
}

const goToPrivacyPolicy = () => {
  router.push('/privacyPolicy')
}

const goToServiceType = () => {
  router.push('/serviceType')
}

const goToServiceProcess = () => {
  router.push('/serviceProcess')
}
</script>

<style scoped>
/* 保持原有的全局样式 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Microsoft YaHei', Arial, sans-serif;
}

body {
  background-color: #f5f7fa;
  color: #333;
  line-height: 1.6;
}

a {
  text-decoration: none;
  color: inherit;
}

ul {
  list-style: none;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 15px;
}

.btn {
  display: inline-block;
  padding: 10px 20px;
  background-color: #4a90e2;
  color: white;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.3s;
  border: none;
  font-size: 16px;
}

.btn:hover {
  background-color: #3a7bc8;
}

.btn-secondary {
  background-color: #6c757d;
}

.btn-secondary:hover {
  background-color: #5a6268;
}

/* 导航栏样式 */
header {
  background-color: white;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  position: sticky;
  top: 0;
  z-index: 100;
}

nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 0;
}

.logo {
  font-size: 24px;
  font-weight: bold;
  color: #4a90e2;
}

.logo span {
  color: #333;
}

.nav-links {
  display: flex;
  gap: 30px;
}

.nav-links a {
  font-weight: 500;
  transition: color 0.3s;
}

.nav-links a:hover {
  color: #4a90e2;
}

.nav-links a.active {
  color: #4a90e2;
  font-weight: bold;
}

.nav-buttons {
  display: flex;
  gap: 15px;
}

/* 联系我们的内容样式 */
.contact-container {
  padding: 60px 0;
  min-height: calc(100vh - 200px);
}

.section-title {
  text-align: center;
  margin-bottom: 50px;
}

.section-title h2 {
  font-size: 32px;
  color: #2c3e50;
  margin-bottom: 15px;
}

.section-title p {
  color: #777;
  max-width: 700px;
  margin: 0 auto;
}

.contact-content {
  max-width: 900px;
  margin: 0 auto;
}

.contact-section {
  margin-bottom: 60px;
}

.contact-section h3 {
  font-size: 24px;
  color: #2c3e50;
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 1px solid #eee;
}

.section-content {
  background-color: white;
  border-radius: 8px;
  padding: 30px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

/* 联系方式样式 */
.contact-methods {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
}

.contact-method {
  display: flex;
  align-items: flex-start;
  gap: 15px;
  padding: 15px;
  border-radius: 6px;
  transition: background-color 0.3s;
}

.contact-method:hover {
  background-color: #f8f9fa;
}

.method-icon {
  font-size: 32px;
  flex-shrink: 0;
}

.method-text h4 {
  font-size: 18px;
  margin-bottom: 8px;
  color: #333;
}

.method-text p {
  color: #666;
  font-size: 14px;
  line-height: 1.6;
}

.method-text .time {
  color: #999;
  font-size: 13px;
  margin-top: 5px;
}

/* 联系表单样式 */
.contact-form {
  display: grid;
  gap: 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
}

.form-group label {
  margin-bottom: 8px;
  font-weight: 500;
  color: #555;
}

.form-group input,
.form-group textarea {
  padding: 12px 15px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 16px;
  transition: border-color 0.3s;
}

.form-group input:focus,
.form-group textarea:focus {
  border-color: #4a90e2;
  outline: none;
}

.form-group textarea {
  resize: vertical;
  min-height: 120px;
}

/* 常见问题样式 */
.faq-list {
  display: grid;
  gap: 20px;
}

.faq-item {
  padding: 20px;
  border-radius: 6px;
  background-color: #f8f9fa;
}

.faq-item h4 {
  font-size: 16px;
  color: #2c3e50;
  margin-bottom: 10px;
}

.faq-item p {
  color: #666;
  font-size: 14px;
  line-height: 1.6;
}

/* 下拉菜单样式 */
.dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  background-color: white;
  min-width: 160px;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
  border-radius: 4px;
  padding: 10px 0;
  z-index: 1000;
}

.dropdown-menu li {
  padding: 8px 20px;
  transition: background-color 0.3s;
}

.dropdown-menu li:hover {
  background-color: #f5f7fa;
}

.dropdown-menu a {
  display: block;
  color: #333;
  white-space: nowrap;
}

.dropdown-menu a:hover {
  color: #4a90e2;
}

.nav-links > li {
  position: relative;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .contact-container {
    padding: 40px 0;
  }

  .section-title h2 {
    font-size: 28px;
  }

  .section-content {
    padding: 20px;
  }

  .contact-methods {
    grid-template-columns: 1fr;
  }

  .nav-links {
    display: none;
  }

  .dropdown-menu {
    position: static;
    box-shadow: none;
    padding-left: 20px;
  }
}

/* 页脚样式 */
footer {
  background-color: #2c3e50;
  color: #fff;
  padding: 60px 0 20px;
}

.footer-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 40px;
  margin-bottom: 40px;
}

.footer-section h3 {
  font-size: 18px;
  margin-bottom: 20px;
  color: #fff;
}

.footer-section p {
  margin-bottom: 15px;
  color: #bbb;
}

.footer-section ul li {
  margin-bottom: 10px;
}

.footer-section a {
  color: #bbb;
  transition: color 0.3s;
}

.footer-section a:hover {
  color: #4a90e2;
}

.copyright {
  text-align: center;
  padding-top: 20px;
  border-top: 1px solid #3d5166;
  color: #bbb;
}
</style>